<template>
    <!--ASN明细-->
    <div id="AsnDetails">
        <v-details :detailData="data.detailData" :inputConfig="inputConfig" :rules="rules" ref="input"></v-details>
    </div>
</template>

<script>

    import details from 'commons/Detail'
    import baseMixin from "@/mixins/BaseMixin";

    export default {
        name: "",
        mixins: [baseMixin],
        props: {
            data: {
                type: Object
            }
        },
        data() {
            return {}
        },
        computed: {
            rules() {
                if (this.data.type == "userBillgrps_List") {
                    return {
                        bill_group: [
                            {required: true, trigger: 'blur'},
                        ]
                    }
                } else if (this.data.type == "printer_List") {
                    return {
                        report_code: [
                            {required: true, trigger: 'blur'},
                        ],
                        printer_servername: [
                            {required: true, trigger: 'blur'},
                        ],
                        printer_name: [
                            {required: true, trigger: 'blur'},
                        ]
                    }
                }
            },
            inputConfig() {
                if (this.data.type == "userBillgrps_List") {
                    return [
                        [
                            {
                                type: "select",
                                label: "账单组",
                                props: "bill_group",
                                options: this.getOptions("queryBillGroup")
                            }
                        ],
                    ]
                } else if (this.data.type == "printer_List") {
                    return [
                        [
                            {
                                type: "select",
                                label: "报告",
                                props: "report_code",
                                options: this.getOptions("queryReport/zh")
                            },
                            {
                                type: "input",
                                label: "服务器名称",
                                props: "printer_servername",
                            },
                            {
                                type: "input",
                                label: this.$t('manage.printername'),
                                props: "printer_name",
                            }
                        ],
                    ]
                }
            }
        },
        methods: {},
        mounted() {

        },
        watch: {},
        components: {
            'v-details': details
        }
    }
</script>

<style scoped>

</style>
